﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<title>广告自助后台</title>
<link href="css/css.css" rel="stylesheet" type="text/css"/>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.js" type="text/javascript"></script>
<script type="text/javascript">
 		var _finished=true;//标志是否上传结束
 		var tid;
 		var jpgid;
 		function showState(){
 			_finished=false;
 			$("#progressBar").css("display","block");
 			$("#progressBarItem").css("width","1%");
 			$("#apk_submit").attr("disabled",true);
 			$("#apk_file_tips").text("");
			tid=setInterval(requestStatus,1000);
 		}
 		
		function requestStatus(){
 			if(_finished){clearInterval(tid);return;}//上传结束则返回
 			$.ajax({
		            type: "get",
		            url: "s_upload_apk.do",
		            dataType: "json",
		            success: function (data) {
            				$("#progressBarItem").css("width",data.percent + "%");
 				            if (!isNull(data.validinfo)) {
 				                _finished=true;
 				                $("#apk_submit").attr("disabled",false);
 				                $("#apk_file_tips").text(data.validinfo);
 				                return;
 				            }
 				            
			 				if(data.status=='finished'){
			 					_finished=true;
			 					$("#apk_submit").attr("disabled", false);
			 					$("#icon_url").attr("src", data.appinfo.iconHttpPath);
			 					$("#versionName").attr("value", data.appinfo.version);
			 					$("#filesize").attr("value", data.appinfo.apk_size);
			 					$("#apk_file").val(data.tmpApkName);
			 					$("#packagename").val(data.appinfo.packagename);
			 					$("#iconhttppath").val(data.appinfo.iconHttpPath);
			 					
			 				}
		            },
		            error: function (XMLHttpRequest, textStatus, errorThrown) {
		                    alert(errorThrown);
		            }
		    });
 			
 		}
 		
 		function showState_image(type){
 			_finished=false;
 			$("#progressBar"+type).css("display","block");
 			$("#progressBarItem"+type).css("width","1%");
 			$("#image_submit"+type).attr("disabled",true);
 			$("#jpg_tips").text("");
 			jpgid = type;
			tid=setInterval(requestStatus_image,1000);
 		}
 		
		function requestStatus_image(type){
 			if(_finished){clearInterval(tid);return;}//上传结束则返回
 			$.ajax({
		            type: "get",
		            url: "s_upload_image.do",
		            dataType: "json",
		            success: function (data) {
		            
 				            if (!isNull(data.validinfo)) {
 				                _finished=true;
 				                $("#image_submit"+jpgid).attr("disabled",false);
 				                $("#jpg_tips").text(data.validinfo);
 				                return;
 				            }
		            
			 				if(data.status=='finished'){
			 					_finished=true;
			 					$("#image_submit"+jpgid).attr("disabled",false);
			 					$("#jpg_"+jpgid).attr("src", data.jpgPath);
			 					$("#image_name"+jpgid).val(data.jpgName);
			 				}
		            },
		            error: function (XMLHttpRequest, textStatus, errorThrown) {
		                    alert(errorThrown);
		            }
		    });
 			
 		}
 		
 	</script>

</head>

<body>
<div id="tray" class="box">
    <p class="f-left box">
    <p class="f-right">帐 号: <strong><a href="#">${aduser.username }</a></strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><a href="logout" id="logout">登 出</a></strong></p>
</div>
<div id="cols">
    <div class="sliderbar">
      <div><img src="css/images/logo.png" /></div>
      <ul class="box">
        <li <c:if test="${channel=='list'}">id="submenu-active"</c:if>>
        <a href="s_applist">应用列表</a>
        </li>
        <li <c:if test="${channel=='addapp'}">id="submenu-active"</c:if>>
        <a href="s_addapp">添加应用</a>
        </li>
        <li <c:if test="${channel=='advlist'}">id="submenu-active"</c:if>>
        <a href="s_advlist">广告主列表</a>
        </li>
        <li <c:if test="${channel=='addadv'}">id="submenu-active"</c:if>>
        <a href="s_addadv">添加广告主</a>
        </li>
        <li <c:if test="${channel=='account'}">id="submenu-active"</c:if>>
        <a href="#">账户管理</a>
        </li>
        <li <c:if test="${channel=='help'}">id="submenu-active"</c:if>>
        <a href="#">帮助</a>
        </li>
      </ul>
    </div>
<div class="tab">
<div style="_clear: both; height: 0; _overflow: hidden"></div>
<!-- IE6 clear float --></div>
<div class="content">
<div class="title">
<h2>发布新的推广包</h2>
</div>
<div class="list">
<div style="padding-top: 20px"><input id="common_market_user_flg"
	name="common_market_user_flg" value="1" type="hidden">
<div id="app_s1" class="text_content">
<ul id="app_file" class="app_file">
	<li style="_height: 50px"><!-- IE6 height hack -->
	<dl class="cl">
		<dt class="fl"><strong>1</strong></dt>
		<dd class="fl"><strong>上传应用文件</strong><br>
		上传后将自动解析出图标等信息，无需手动填写。[不得超过100M]</dd>
	</dl>
	</li>
	<li class="clear line2"><iframe name="upload_iframe" width="0" height="0"></iframe>
		<div id="upload_apk" _type="add" style="overflow: auto; min-height: 40px">
		<form method="post" target="upload_iframe" action="s_upload_apk.do" enctype="multipart/form-data" onsubmit="showState();">
		<div id="apk_upload_div" class="fl">选择应用文件：
			<input type="file" name="apk" id="apk" /> 
			<input id="apk_submit" type="submit" value="提交" />
			<span class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;">apk文件格式，小于100M</span>
			<span id="apk_file_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
			<br/><br/>
			<div style="width: 250px; height: 10px; overflow: hidden; border: solid 1px #ccc; margin-left: 103px">
			<div id="progressBar" style="display: none;">
			<div id="progressBarItem"></div>
			</div>
			</div>
		</div>
		<div class="fl" style="padding-left: 20px; width: 500px">

		</form>
		</div>
	</li>
</ul>
</div>

<!-- <div class="text_content"> -->
<div id="app_s2" class="text_content" style="">
<form id="new_app_form" method="post" action="s_newapp.do">
	<input id="apk_file" name="apk_file" type="hidden"/> 
	<input id="iconhttppath" name="iconhttppath" type="hidden"/>
	<input id="image_name1" name="image_name1" type="hidden"/>
	<input id="image_name2" name="image_name2" type="hidden"/>
	<input id="image_name3" name="image_name3" type="hidden"/>
	<input id="packagename" name="packagename" type="hidden"/>
	<input id="hidden_active" name="hidden_active" type="hidden"/>
	<input id="hidden_tiyan" name="hidden_tiyan" type="hidden"/>
	<input id="hidden_tiyan_type" name="hidden_tiyan_type" type="hidden"/>
	<input id="hidden_adv_price" name="hidden_adv_price" type="hidden"/>
<ul id="app_info">

	<li class="line1" style="_height: 50px"><!-- IE6 height hack -->
	<dl class="cl">
		<dt class="fl"><strong>2</strong></dt>
		<dd class="fl"><strong>填写推广应用信息</strong><br>
		请将信息填写完整，并确保信息的正确性。</dd>
	</dl>
	</li>
	<li class="clear"><span class="kaifazhe_text_01">图标
	<sup class="red">*</sup>：</span>
	<div class="fl">
	<div class="clear">
	<div class="fl" style="padding: 0 8px 0 0;">
	<img id="icon_url" src="" height="48" width="48"/>
	</div>
	</div>
	</div>
	<div style="clear: both"></div>
	</li>
	<li class="clear">
	    <span class="kaifazhe_text_01">名称 <sup class="red">*</sup>：</span> 
	    <input value="" id="appname" name="appname" class="yingyong_text_input01" type="text"/> 
	    <span class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;">2～10个字符</span>
	    <span id="appname_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
	</li>
	<li class="clear">
	    <span class="kaifazhe_text_01">版本 <sup class="red">*</sup>：</span>
	    <div class="fl">
	    <input id="versionName" name="versionname" class="yingyong_text_input01 readonly" style="float: none" readonly="readonly" type="text"/>
	    </div>
	</li>
	<li class="clear"><span class="kaifazhe_text_01">大小 <sup class="red">*</sup>：</span> 
	    <input name="filesize" id="filesize" class="yingyong_text_input01 readonly" readonly="readonly" type="text"/>
	</li>
	<li class="clear"><span class="kaifazhe_text_01">类别 <sup class="red">*</sup>：</span> 
	    <select id="category" name="category" class="yingyong_select01" style="width: 298px">
		<option value="0">-- 请选择分类 --</option>
		<optgroup label="应用">
			<option value="电子办公">电子办公</option>
			<option value="影音播放">影音播放</option>
			<option value="铃声下载">铃声下载</option>
			<option value="摄影图像">摄影图像</option>
			<option value="赛事快讯">赛事快讯</option>
			<option value="健康医疗">健康医疗</option>
			<option value="资讯新闻">资讯新闻</option>
			<option value="生活娱乐">生活娱乐</option>
			<option value="日历闹钟">日历闹钟</option>
			<option value="网络购物">网络购物</option>
			<option value="阅读软件">阅读软件</option>
			<option value="其他应用">其他应用</option>
			<option value="金融理财">金融理财</option>
			<option value="天气预报">天气预报</option>
			<option value="社区交友">社区交友</option>
			<option value="聊天工具">聊天工具</option>
			<option value="通话通信">通话通信</option>
			<option value="浏览器">浏览器</option>
			<option value="输入法">输入法</option>
			<option value="系统工具">系统工具</option>
			<option value="实用工具">实用工具</option>
			<option value="主题美化">主题美化</option>
			<option value="词典翻译">词典翻译</option>
			<option value="交通导航">交通导航</option>
			<option value="旅游助手">旅游助手</option>
			<option value="教育学习">教育学习</option>
			<option value="小说漫画">小说漫画</option>
		</optgroup>
		<optgroup label="游戏">
			<option value="棋牌益智">棋牌益智</option>
			<option value="模拟器">模拟器</option>
			<option value="体育竞技">体育竞技</option>
			<option value="策略回合">策略回合</option>
			<option value="竞速狂飙">竞速狂飙</option>
			<option value="网络游戏">网络游戏</option>
			<option value="冒险游戏">冒险游戏</option>
			<option value="经营养成">经营养成</option>
			<option value="射击飞行">射击飞行</option>
			<option value="动作格斗">动作格斗</option>
			<option value="角色扮演">角色扮演</option>
			<option value="趣味休闲">趣味休闲</option>
			<option value="其他游戏">其他游戏</option>
		</optgroup>
	</select>
	<span id="category_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
	</li>
	
	<li class="clear"><span class="kaifazhe_text_01">简短介绍 <sup class="red">*</sup>：</span>
		<div class="fl">
		<input id="summary" name="summary" class="yingyong_text_input01" style="width: 477px; float: none" type="text"/>
		<span id="summary_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
		<div class="field_notice">用于列表页面展示，10 - 50个字符<br/>
		例：鸟蛋被偷了，小鸟很愤怒。</div>
		</div>
	</li>
	<li class="clear"><span class="kaifazhe_text_01">应用介绍 <sup class="red">*</sup>：</span>
		<div class="fl">
			<textarea id="description" name="description" class="yingyong_text_input03 no_f"></textarea>
			<span id="description_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
		<div class="field_notice w700">用于应用详细页面展示，10 - 200个字符.<br/>
	</div>
	</div>
	</li>
	<li class="clear"><span class="kaifazhe_text_01">激活延迟 <sup class="red">*</sup>：</span>
		<div class="fl">
		<input value="" id="active_time" name="active_time" class="yingyong_text_input01" style="width: 477px; float: none" type="text"/>
		<span class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;">秒</span>
		<span id="active_time_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
		<div class="field_notice">用于激活等待时间</div>
		</div>
	</li>
	<li class="clear"><span class="kaifazhe_text_01">激活类型 <sup class="red">*</sup>：</span>
	    <select id="active_type_id" name="active_type_id" >
	    	<option value="-1">请选择激活类型</option>
	        <c:forEach items="${activeType}" var="item" varStatus="status">
	        <option value="${item.active_type_id}">${item.active_type_name}</option>
	        </c:forEach>
	    </select>
	    <span id="active_type_id_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
	</li>
	<li class="clear"><span class="kaifazhe_text_01">应用状态 <sup class="red">*</sup>：</span>
	    <select id="status" name="status" >
	    	<option value="-1">请选择应用状态</option>
	        <option value="online">在线</option>
	        <option value="offline">下线</option>
	    </select>
	    <span id="status_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
	</li>
</ul>	
</form>
<iframe name="upload_iframe_image" width="0" height="0" style="display:none"></iframe> 
<ul id="app_info">
	
	<li id="screen_imgs" class="clear line2" style="padding-bottom: 5px"><span
		class="kaifazhe_text_01">应用截图 <sup class="red">*</sup>：</span>

	<div class="fl">
		<form method="post" target="upload_iframe_image" action="s_upload_image.do" enctype="multipart/form-data" onsubmit="showState_image(1);">
			<input style="float: none" type="file" name="image" id="image" />
			<input id="image_submit1" type="submit" value="上传" />
			<br/>
			<img id="jpg_1" width=200/>
			
		</form>
		<form method="post" target="upload_iframe_image" action="s_upload_image.do" enctype="multipart/form-data" onsubmit="showState_image(2);">
			<input style="float: none" type="file" name="image" id="image" /> 
			<input id="image_submit2" type="submit" value="上传" />
			<br/>
			<img id="jpg_2" width=200/>
		</form>		
		<form method="post" target="upload_iframe_image" action="s_upload_image.do" enctype="multipart/form-data" onsubmit="showState_image(3);">
			<input style="float: none" type="file" name="image" id="image" /> 
			<input id="image_submit3" type="submit" value="上传" />
			<br/>
			<img id="jpg_3" width=200/>
		</form>	
		<span id="jpg_tips" class="field_notice" style="padding: 0 0 0 0px; line-height: 24px;color: red"></span>
	</div>

	</li>

	<li>
		<div class="field_notice" style="margin-left: 90px">分辨率只能是 320x480, 480x320像素。<br/>
		必须 jpg 格式，图片不大于200K。<br/>
		需要上传 3 张图片。</div>
	</li>
	
	<li class="line1" style="_height: 50px"><!-- IE6 height hack -->
	<dl class="cl">
		<dt class="fl"><strong>3</strong></dt>
		<dd class="fl"><strong>自定义推广单价</strong><br>
		您可以为自己的产品制定推广单价</dd>
	</dl>
	</li>
	
	<li class="clear"><span class="kaifazhe_text_01">广告主单价 <sup class="red">*</sup>：</span>
	    <input id="adv_price" name="adv_price" class="yingyong_text_input01" type="text" style="width: 50px"/>
	    <span class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;">人民币</span>
	    <span id="adv_price_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
	</li>
	
	<li class="clear"><span class="kaifazhe_text_01">激活单价 <sup class="red">*</sup>：</span>
	    <input id="active" name="active" class="yingyong_text_input01" type="text" style="width: 50px"/>
	    <span class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;">人民币</span>
	    <span id="active_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
	</li>
	
	<li class="clear"><span class="kaifazhe_text_01">体验单价 <sup class="red">*</sup>：</span>
	    <input id="tiyan" name="tiyan" class="yingyong_text_input01" type="text" style="width: 50px"/>
	    <span class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;">人民币</span>
	    <span id="tiyan_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
	    <select id="tiyan_type" name="tiyan_type" >
	    	<option value="-1">请选择体验套餐</option>
	        <option value="2">每次体验大于60秒，体验间隔大于一天，前1次体验有奖励</option>
	        <option value="5">每次体验大于60秒，体验间隔大于一天，前2次体验有奖励</option>
	        <option value="6">每次体验大于60秒，体验间隔大于一天，前3次体验有奖励</option>
	    </select>
	    <span id="tiyan_type_tips" class="field_notice" style="padding: 0 0 0 10px; line-height: 24px;color: red"></span>
	</li>
	
	<li>
		<div class="field_notice" style="margin-left: 90px">
            <button type="button" onclick="add_app_form();">提交应用信息</button>
        </div>
	</li>
</ul>
</div>

</div>
</div>
</div>
<div style="height: 1px; overflow: hidden">&nbsp;</div>
</div>
<div class="ct_bottom"></div>

<div id="footer" class="footer"></div>

<div class="page_msg_box">
<div id="msg" class="page_msg_cont"></div>

</div>

<!-- JS -->
<!--[if lt IE 7]>
<script src="/js/png-fix.js?ver=2012120617" type="text/javascript"></script>
<script type="text/javascript">
DD_belatedPNG.fix('.ie_png');
</script>
<![endif]-->
<script src="js/jquery-ui-1.js" type="text/javascript"></script>
<script src="js/jquery_003.js" type="text/javascript"></script>
<script src="js/jquery_002.js" type="text/javascript"></script>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/common.js" type="text/javascript"></script>
<script src="js/validform.js" type="text/javascript"></script>
</body>
</html>